#include <iostream>
#include "main.h"

int main(int argc, char *argv[])
{
    std::cout << "123" << std::endl;
    JoyStickDriver  joystick;
    

    while(1)
    {
        int len = joystick.JoyStickRead();
        if (len < 0)
        {
            usleep(10*1000);
            continue;
        }
 
        printf("\rTime:%8d A:%d B:%d X:%d Y:%d LB:%d RB:%d select:%d start:%d lo:%d ro:%d XX:%-6d YY:%-6d LX:%-6d LY:%-6d RX:%-6d RY:%-6d LT:%-6d RT:%-6d",
                joystick.joystickData.time, 
                joystick.joystickData.a, joystick.joystickData.b, 
                joystick.joystickData.x, joystick.joystickData.y, 
                joystick.joystickData.lb, joystick.joystickData.rb, 
                joystick.joystickData.select, joystick.joystickData.start, 
                joystick.joystickData.lo, joystick.joystickData.ro,
                joystick.joystickData.xx, joystick.joystickData.yy, 
                joystick.joystickData.lx, joystick.joystickData.ly, 
                joystick.joystickData.rx, joystick.joystickData.ry, 
                joystick.joystickData.lt, joystick.joystickData.rt);
        fflush(stdout);
    }
    return 0;
}
